package com.sdruixinggroup.mondayb2b.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.sdruixinggroup.mondayb2b.R;
import com.sdruixinggroup.mondayb2b.models.HomeBeen;

import butterknife.BindView;

/**
 * Created by Administrator on 2017/12/10.
 */

public class HomeHotGoodsView extends AbCustomHeaderView {
    @BindView(R.id.iv_pic)
    ImageView ivPic;
    @BindView(R.id.tv_type)
    TextView tvType;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.tv_price)
    TextView tvPrice;

    public HomeHotGoodsView(Context context) {
        super(context);
    }

    public HomeHotGoodsView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public HomeHotGoodsView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public int getInflateLayout() {
        return R.layout.home_hot_goods_view;
    }

    @Override
    public void setUpView(View view) {

    }

    public void setData(HomeBeen.HotBean hotBean) {
        Glide.with(getContext()).load(hotBean.getThumb()).error(R.drawable.home_special_one).into(ivPic);
        if(1== hotBean.getType()){
            tvType.setVisibility(VISIBLE);
        }else {
            tvType.setVisibility(GONE);
        }
        tvName.setText(hotBean.getName());
        tvPrice.setText("¥"+hotBean.getPrice());
    }
}
